package com.walala.logic.utils;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CommonUtils {
	
	private static Logger logger = LoggerFactory.getLogger(CommonUtils.class);

	public static String getRealPath() {
		logger.info("[getRealPath]start...");
		String realPath = CommonUtils.class.getClassLoader().getResource("").getFile();
		// String realPath = Class.class.getResource("/").getPath();
		logger.info("[getRealPath]realPath is {}", realPath);
		File file = new File(realPath);
		if (realPath.indexOf("bin") > 0) {
			realPath = file.getParentFile().getAbsolutePath();
		} else {
			realPath = file.getAbsolutePath();
		}
		logger.info("[getRealPath]end...,realPath is {}", realPath);
		return realPath;
	}
	
}

